<template>
  <el-dialog :show-close="false" :visible.sync="isShow" title="文章安全设置" width="30%">
    <!--内容主体-->
    <el-form label-width="50px" @submit.native.prevent>
      <el-form-item>
        <el-radio-group v-model="radio">
          <el-radio :label="1">公开</el-radio>
          <el-radio :label="2">仅自己可见</el-radio>
          <el-radio :label="3">密码保护</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item v-if="radio === 3" label="密码">
        <el-input v-model="form.password"></el-input>
      </el-form-item>
      <el-form-item v-if="radio !== 2">
        <el-row>
          <el-col :span="6">
            <el-switch v-model="form.appreciation" active-text="赞赏"></el-switch>
          </el-col>
          <el-col :span="6">
            <el-switch v-model="form.recommend" active-text="推荐"></el-switch>
          </el-col>
          <el-col :span="6">
            <el-switch v-model="form.commentEnabled" active-text="评论"></el-switch>
          </el-col>
          <el-col :span="6">
            <el-switch v-model="form.top" active-text="置顶"></el-switch>
          </el-col>
        </el-row>
      </el-form-item>
    </el-form>
    <!--底部-->
    <span slot="footer">
      <el-button v-if="!loading" @click="cancel">取 消</el-button>
      <el-button :loading="loading" type="primary" @click="handleSave">保存</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    name: 'SecuritySettingDialog',
    components: {},
    props: {
      form: {
        type: Object,
        required: true,
      },
      isShow: {
        type: Boolean,
        required: true,
      },
      radio: {
        type: Number,
        required: true,
      },
      loading: {
        type: Boolean,
        default: false,
      },
    },
    data() {
      return {}
    },
    computed: {},
    methods: {
      handleSave() {
        this.$emit('save')
      },
      cancel() {
        this.$emit('cancel')
      },
    },
  }
</script>

<style lang="scss" scoped></style>
